package com.xbao.controller;

import com.xbao.core.component.page.Pagination;
import com.xbao.core.http.CommRequest;
import com.xbao.core.http.CommResult;
import com.xbao.model.Cls;
import com.xbao.model.req.StuReq;
import com.xbao.model.vo.ClsVo;
import com.xbao.model.vo.OrgStuCountVo;
import com.xbao.model.vo.StuVo;
import com.xbao.model.vo.WaitDealStuTotalVo;
import com.xbao.service.StuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by qingshengzheng on 18/8/25.
 */
@Api(value = "/stu", tags = "stu")
@RequestMapping(value = "stu")
@Controller
@EnableAutoConfiguration
public class StuController extends BaseController {
    @Resource
    private StuService stuService;

    /**
     *
     * @return
     */
    @ApiOperation(value = "addStu", notes = "addStu")
    @RequestMapping(value = "/addStu",method = RequestMethod.POST)
    @ResponseBody
    public CommResult typetotal(@RequestBody CommRequest<StuReq> stuReq) {
        stuService.addStu(stuReq.getData());
        return result();
    }

    /**
     *
     * @param stuReq
     * @return
     */
    @ApiOperation(value = "delete", notes = "delete")
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ResponseBody
    public CommResult delete(@RequestBody CommRequest<StuReq> stuReq) {
        stuService.deleteStu(stuReq.getData().getId());
        return result();
    }



    /**
     *
     * @param stuReq
     * @return
     */
    @ApiOperation(value = "addStu", notes = "addSubject")
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    @ResponseBody
    public CommResult addStu(@RequestBody CommRequest<StuReq> stuReq) {
        stuService.addStu(stuReq.getData());
        return result();
    }

    /**
     *
     * @param stuReqCommRequest
     * @return
     */
    @ApiOperation(value = "queryStus", notes = "queryStus")
    @RequestMapping(value = "/query",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> queryStus(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.queryStu(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);

    }

    /**
     *
     * @param stuReq
     * @return
     */
    @ApiOperation(value = "updateStu", notes = "updateStu")
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    @ResponseBody
    public CommResult updateStu(@RequestBody CommRequest<StuReq> stuReq) {
        stuService.updateStu(stuReq.getData());
        return result();

    }

    /**
     *
     * @param stuReq
     * @return
     */
    @ApiOperation(value = "stuDetail", notes = "stuDetail")
    @RequestMapping(value = "/detail",method = RequestMethod.POST)
    @ResponseBody
    public CommResult stuDetail(@RequestBody CommRequest<StuReq> stuReq) {
        StuVo vo=stuService.detail(stuReq.getData().getId());
        return new CommResult<StuVo>(vo);
    }

    /**
     *
     * @param stuReqCommRequest
     * @return
     */
    @ApiOperation(value = "baseOrgStuCount", notes = "baseOrgStuCount")
    @RequestMapping(value = "/baseorgstucount",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<OrgStuCountVo> baseOrgStuCount(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        OrgStuCountVo orgStuVo = stuService.baseOrgStuCount(stuReqCommRequest.getOrgid());
        return new CommResult<OrgStuCountVo>(orgStuVo);
    }
    @ApiOperation(value = "stuOfLession", notes = "stuOfLession")
    @RequestMapping(value = "/stuOfLession",method = RequestMethod.POST)
    @ResponseBody
    public CommResult stuOfLession(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        stuService.stuOfCls(stuReqCommRequest.getData().getId());
        return result();
    }

   /* @ApiOperation(value = "clssOfStu", notes = "clssOfStu")
    @RequestMapping(value = "/clssOfStu",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<ClsVo>> clssOfStu(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<ClsVo> clsVoList = stuService.clsOfStu(stuReqCommRequest.getData().getId());
        return new CommResult<List<ClsVo>>(clsVoList);
    }
*/
    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "waitDetailStusInfo", notes = "waitDetailStusInfo")
    @RequestMapping(value = "/waitDetailStusInfo",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<WaitDealStuTotalVo> waitDetailStusInfo(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        WaitDealStuTotalVo vo = stuService.waitDetailStusInfo(stuReqCommRequest.getData());
        return new CommResult<WaitDealStuTotalVo>(vo);
    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "fb7days", notes = "fb7days")
    @RequestMapping(value = "/fb7days",method = RequestMethod.POST)
    @ResponseBody
    public CommResult f7days(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.futureBirthdayStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);

    }
    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "noconcart", notes = "noconcart")
    @RequestMapping(value = "/moconcart",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<WaitDealStuTotalVo> noconcart(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        WaitDealStuTotalVo vo = stuService.waitDetailStusInfo(stuReqCommRequest.getData());
        return new CommResult<WaitDealStuTotalVo>(vo);
    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "remainPeriodRecordLt", notes = "remainPeriodRecordLt")
    @RequestMapping(value = "/remainPeriodRecord",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> remainPeriodRecordLt(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> stuvos = stuService.remainPeriodRecordLt(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(stuvos);
    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "endTimeLt", notes = "endTimeLt")
    @RequestMapping(value = "/endTimeLt",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> endTimeLt(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.endTimeLt(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);

    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "noPeriodRecordStus", notes = "noPeriodRecordStus")
    @RequestMapping(value = "/noPeriodREcordStus",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> noPeriodRecordStus(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.noPeriodRecordStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);

    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "waitAbsentDealStus", notes = "waitAbsentDealStus")
    @RequestMapping(value = "/waitAbsentDealStus",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> waitAbsentDealStus(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.waitAbsentDealStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);

    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "noBindWxStus", notes = "noBindWxStus")
    @RequestMapping(value = "/noBindWxStus",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> noBindWxStus(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.noBindWxStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);
    }
    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "queryByTag", notes = "queryByTag")
    @RequestMapping(value = "/queryByTag",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> queryByTag(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.noBindWxStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);
    }

    /**
     *
     * @param stuReqCommRequest
     */
    @ApiOperation(value = "AbsentStus", notes = "AbsentStus")
    @RequestMapping(value = "/AbsentStus",method = RequestMethod.POST)
    @ResponseBody
    public CommResult<List<StuVo>> AbsentStus(@RequestBody CommRequest<StuReq> stuReqCommRequest) {
        List<StuVo> vos = stuService.absendStus(stuReqCommRequest.getData());
        return new CommResult<List<StuVo>>(vos);
    }


}
